//
//  StressModel.m
//  uteped_sdk
//
//  Created by mateng on 2024/2/28.
//

#import "StressModel.h"

@implementation StressModel

- (void)from:(UTEModeStressOneData *)data {
    self.time = data.startTime;
    self.pressureValue = data.stressValue;
    self.calendarTime = [DateUtils timeStampToString:self.time fmt:FMT_TIME_CLANDER_TIME];
    self.calendar = [DateUtils timeStampToString:self.time fmt:FMT_TIME_CLANDER];
    
    if (self.pressureValue > 79) {
        self.level = 4;
    } else if (self.pressureValue > 59) {
        self.level = 3;
    } else if (self.pressureValue > 29) {
        self.level = 2;
    } else {
        self.level = 1;
    }
    
    [self.storeData setObject:@(self.time) forKey:@"time"];
    [self.storeData setObject:@(self.pressureValue) forKey:@"pressure_value"];
    [self.storeData setObject:@(self.level) forKey:@"level"];
    [self.storeData setObject:self.calendarTime forKey:@"calendar_time"];
    [self.storeData setObject:self.calendar forKey:@"calendar"];
}

@end
